﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;

namespace ProjetoClasse.Util
{
    class WebRequestUtil
    {
        public string getResponse(Uri uri, string method)
        {
            WebRequest request = WebRequest.Create(uri);
            request.Method = method;
            WebResponse response = request.GetResponse();
            Stream dataStream = response.GetResponseStream();
            StreamReader sr = new StreamReader(dataStream);
            string responseFromServer = sr.ReadToEnd();
            sr.Close();
            dataStream.Close();
            response.Close();
            return responseFromServer;
        }
    }
}
